<!Doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="csrf-token" content="{{ csrf_token() }}">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">	
	<link rel="shortcut icon" type="image/x-icon" href="{{URL::asset('handan/images/logo-icon.png')}}" />
	<title>分析师</title>
	<link rel="stylesheet" href="{{URL::asset('mobile/css/public.css') }}"/>
	<link rel="stylesheet" href="{{URL::asset('mobile/css/analyst.css') }}"/>
	<script src="{{URL::asset('public_js/jquery-3.2.1.min.js')}}"></script>
	<script src="{{ URL::asset('public_js/src/Highcharts-5.0.10/code/highcharts.js') }}"></script>
	<script src="{{ URL::asset('public_js/src/Highcharts-5.0.10/code/modules/exporting.js') }}"></script>
	<script src="{{ URL::asset('public_js/src/Highcharts-5.0.10/code/highcharts-more.js') }}"></script>
	<script src="{{ URL::asset('public_js/src/Highcharts-5.0.10/code/modules/solid-gauge.js') }}"></script>
	<script src="{{URL::asset('mobile/js/public.js') }}"></script>
	<script src="{{URL::asset('mobile/js/analyst.js') }}"></script>
</head>
<body>
	<!--搜索弹层-->
	<div class="search_main">
		<div>
		<form id="search-form" action="{{ url('bdlists') }}" method="get" style="display: inline-block;">
			<input type="text" placeholder="请输入交易大师昵称" class="search_txt" name="searchname" value="{{$searchname}}"/>
			<input type="hidden"  name="type" value="{{$type}}">
            <input type="hidden"  name="grade" value="{{$grade}}">
            <input type="hidden"  name="bdtype" value="{{$bdtype}}">
			<div>
				<input type="button" onclick="resetl({{$grade}},{{$bdtype}},{{$type}});" value="重置"/>
				<input type="button" onclick="searched();" value="搜索"/>
			</div>
		</form>
		</div>
	</div>
	<div class="l_btn_tab">
			<!--tab导航-->
			<div class="l_box_nav">
				<ul>
					<li class="cur"><a href="javascript:;" target="_blank">策略大师榜</a></li>
					<li onclick='window.location.href="{{ url("active") }}"'><a href="javascript:;" target="_blank">明日之星榜</a></li>
				</ul>
			</div>
			<!-- 总收益曲线图 -->
			<section class="profitchart_title" style="height: 3.0rem;border-top: 0.025rem solid #2e303e;border-bottom: 0.025rem solid #2e303e;padding: 0 0.6rem;margin-top: 0.15rem;">
				<div class="top">
					<p style="font-size: 0.7rem;margin-top: 0.7rem;margin-bottom: 0.1rem;">总收益</p>
				</div>
				<div class="bottom" style="display:-webkit-box;display: -moz-box;display: -ms-flexbox;display: -webkit-flex;display: flex;justify-content: space-between;align-items: center;">
					<p style="font-size: 0.6rem;color: #6c6c79;">EAI分析师收益曲线图</p>
					<p style="font-size: 0.7rem;color: #e03449;font-weight: bold;">{{$totalbballpoint}}<span style="font-size: 0.6rem;font-weight: normal;">点</span></p>
				</div>
			</section>
			<section class="totalprofit" style="height: 7.5rem;margin-top: 0.5rem;">
				<div style="height: 7.5rem;">
						<div id="profit_chart" style="height: 7.5rem;"></div>
				</div>
			</section>
			<!--tab内容-->
			<div class="l_list_con">
				<div class="l_list l_list_show">
					<ul>
						<li>
							<!--交易大导航-->
							<div class="l_master_nav">
								<div class="l_left_nav" onclick="leftNav();">
									<span>按类型:</span>
									<div class="l_typebox">
										<div>
											@if($bdtype == 0) 段位 
											@elseif($bdtype == 1)总盈
											@elseif($bdtype == 2)胜率
											@elseif($bdtype == 3)单均
											@endif
										</div>
									</div>
								</div>
								<div class="l_right_nav" onclick="rightNav();">
									<span>按时间:</span>
									<div class="l_typebox">
										<div>
											@if($type == 0) 全部
											@elseif($type == 1)近一周
											@elseif($type == 2)近一月
											@elseif($type == 3)近三月
											@endif
										</div>
									</div>
								</div>
								<div class="l_search"><img src="{{URL::asset('mobile/image/search_append.png') }}" alt="" /></div>
							</div>							
							<!--筛选列表-->
							<section class="filter1">
								<ul>
									<li onclick="totle({{$grade}},0,{{$type}},'{{$searchname}}');">
										<div class="square">
									       <input type="checkbox" value="None" id="square1" name="check" @if($bdtype == 0) checked @endif/>
									       <label for="square1">
									       		段位
									       </label>
									    </div>
									</li>
									<li onclick="totle({{$grade}},1,{{$type}},'{{$searchname}}');">
										<div class="square">
									       <input type="checkbox" value="None" id="square2" name="check" @if($bdtype == 1) checked @endif/>
									       <label for="square2">
									       		总盈
									       </label>
									    </div>
									</li>
									<li onclick="totle({{$grade}},2,{{$type}},'{{$searchname}}');">
										<div class="square">
									       <input type="checkbox" value="None" id="square3" name="check" @if($bdtype == 2) checked @endif/>
									       <label for="square3">
									       		胜率
									       </label>
									    </div>
									</li>
										<li onclick="totle({{$grade}},3,{{$type}},'{{$searchname}}');">
										<div class="square">
									       <input type="checkbox" value="None" id="square4" name="check" @if($bdtype == 3) checked @endif/>
									       <label for="square4">
									       		单均
									       </label>
									    </div>
									</li>
								</ul>
							</section>
							<section class="filter2">
								<ul>
									<li onclick="totle({{$grade}},{{$bdtype}},0,'{{$searchname}}');">
										<div class="square">
									       <input type="checkbox" value="None" id="square5" name="check" @if($type == 0) checked @endif/>
									       <label for="square5">
									       		<a href='javascript:;'>全部</a>
									       </label>
									    </div>
									</li>
									<li onclick="totle({{$grade}},{{$bdtype}},1,'{{$searchname}}');">
										<div class="square">
									       <input type="checkbox" value="None" id="square6" name="check" @if($type == 1) checked @endif/>
									       <label for="square6">
									       		<a href='javascript:;'>近一周</a>
									       </label>
									    </div>
									</li>
									<li onclick="totle({{$grade}},{{$bdtype}},2,'{{$searchname}}');">
										<div class="square">
									       <input type="checkbox" value="None" id="square7" name="check" @if($type == 2) checked @endif/>
									       <label for="square7">
									       		<a href='javascript:;'>近一月</a>
									       </label>
									    </div>
									</li>
									<li onclick="totle({{$grade}},{{$bdtype}},3,'{{$searchname}}');">
										<div class="square">
									       <input type="checkbox" value="None" id="square8" name="check" @if($type == 3) checked @endif/>
									       <label for="square8">
									       		<a href='javascript:;'>近三月</a>
									       </label>
									    </div>
									</li>
								</ul>
							</section>
							<!--区域-->
							@foreach ($list as $key=>$val)
							<section>
								<div class="l_master_title">
									<section onclick="kaiDetails(this);">
									<!--头像-->
										<div class="photo" onclick="mastercenter('{{$val->id}}',event);">
											<div><img src="@if($val->photo) {{ $val->photo}} @else{{URL::asset('mobile/image/photo.png') }} @endif" alt="" /></div>
											@if($val->authstatus == 2)
												<div><img src="{{URL::asset('mobile/image/v.png') }}" alt="" /></div>
											@endif
										</div>
									<!--用户名-->
										<div class="uname">
											<div class="name">{{$val->username}}</div>
											<div class="img">
												@if($val->authstatus == 2)
													<img src="{{URL::asset('mobile/image/renzheng.png') }} " alt="" />
												@else
													<img src="{{URL::asset('mobile/image/analystcenter/tomorrow.png') }} " alt="" />
												@endif
											</div>
										</div>
									<!--段位-->
										<div class="dan">
											<div class="danImg">
												<img src="@if($val->grade == '4') {{ URL::asset('mobile/image/Platinum.png')}} @elseif($val->grade == '3') {{ URL::asset('mobile/image/gold.png')}} @elseif($val->grade == '2') {{ URL::asset('mobile/image/silver.png')}} @elseif($val->grade == '1') {{ URL::asset('mobile/image/copper.png')}} @else {{ URL::asset('mobile/image/tie.png')}} @endif" alt="" />
											</div>
											<div class="danInfo">
												<p>{{(($list->currentPage()-1)*10)+$key+1}}</p>
												<p>排位号</p>
											</div>
										</div>
									</section>
									@if($val->id == session('eai')['id'])
                                        	<!--我看我自己-->
                                    @elseif($val->status == 1) <!--已订阅-->
										<button style="background-color: #4F5660;" onclick="gendan(this);" analyst_id="{{$val->id}}" analyst_username="{{$val->username}}" status="{{$val->status}}" direction="{{$val->direction}}">编辑</button>
									@else
										<button onclick="gendan(this);" analyst_id="{{$val->id}}" analyst_username="{{$val->username}}" status="3" direction="3">订阅</button>
									@endif
								</div>
								<div class="l_master_detail" onclick="mastercenter('{{$val->id}}');">
									<div class="detail">
										<!--图表-->
										<div class="l_left_chart" style="width: 3.475rem; height: 2.55rem;">
											<div class='mChart' id='{{$val->username}}' style="width: 3.475rem; height: 2.55rem;"></div>
										</div>
										<script>
	                                        var x_chart_time  = '{{$val->timesstr}}';
	                                        var x_chart_point = '{{$val->pointstr}}';
	                                        x_chart_point     = x_chart_point.split(',');
	                                        var x_chart_data  = [];
	                                        x_chart_point.forEach(function(data,index,arr){
	                                            x_chart_data.push(+data);
	                                        });
	                                        mAnalystTrend('{{$val->username}}',[x_chart_time.split(','),x_chart_data]);
	                                    </script>
										<div class="l_right_data">
											<ul>
												<li>
													<div class="num">{{round($val->winrate,2)}}%</div>
													<div class="name">胜率</div>
												</li>
												<li>
													<div class="num">{{round($val->final_point,2)}}</div>
													<div class="name">总盈利</div>
												</li>
												<li>
													<div class="num">{{round($val->single_final_point,2)}}</div>
													<div class="name">单均</div>
												</li>
												<li>
													<div class="num">
														@if($val->grade == '4') 金融宗师
				                                        @elseif($val->grade == '3') 操盘大师
				                                        @elseif($val->grade == '2') 分析专家
				                                        @elseif($val->grade == '1') 交易高手
				                                        @else 交易能手                                  
				                                        @endif
													</div>
													<div class="name duanwei">段位</div>
												</li>
												<li>
													<div class="num">{{$val->weekordernum}}</div>
													<div class="name">近一周策略</div>
												</li>
											</ul>
										</div>
									</div>
								</div>
							</section>
							@endforeach
						</li>									
					</ul>
				</div>
				<!-- 分页 -->
				<div  class="pagediv" style="margin: auto;text-align: center;">
					{{ $list->appends(['searchname' => $searchname,'grade' => $grade,'bdtype' => $bdtype,'type' => $type])->links() }}
				</div>
				<div class="l_list">
					<ul>
						<li>
							<a href="javascript:;">明日之星榜</a>
						</li>								
					</ul>
				</div>
			</div>
			<!--订阅按钮弹层-->
			<div class="follow_btn" id="follow_btn">
				<div>
					<div class="bor">
						<span myAttr = '0' class=""></span>
					</div>
					正向订阅
				</div>
				<div></div>
				<div>
					<div class="bor">
						<span myAttr = '1' class=""></span>
					</div>
					反向订阅
				</div>
				<div>
					<div class="squar">
				       <input type="checkbox" value="None" id="squar" name="check" />
				       <label for="squar" id="squar">
				       		<span></span>
				       </label>
				    </div>
					<span>我已阅读并同意<a href="{{url('/agree')}}">《订阅协议》</a></span>
				</div>
				<div>
					<span onclick="cancle();">取消</span>
					<span onclick="sure(this);">确定</span>
				</div>
				<!--取消订阅-->
				<div class="cancel_follow" id="gendancancle" onclick="follow(0,0,this);">
					取消订阅
				</div>
			</div>
	</div>
<div style="height: 9rem;"></div>
@include('mobile.footer')
<style>
	/*底部行情应用样式*/
	footer ul li:nth-child(2) a {
		color: #3B9CE0;
	}
	footer ul li:nth-child(2) a i {
	  background: url("{{URL::asset('mobile/image/fxs_icond.png')}}") no-repeat center / cover;
	}
</style>
<script>
	var bdlists = "{{ url('/bdlists') }}";
	var aid       = 0;
    var analyst_username = '';
    var gotofllow = "{{url('/fllow')}}";
    var status    = 3;//是否订阅
    var direction = 3;//订阅方向
    var gotologin = "{{url('/mlogin')}}";
    //订阅按钮
    function gendan(obj) {
    	$(obj).removeAttr("onclick");
	    var islogin = "<?php echo Session('eai')['tel']?>";
	    if(!islogin){
	        //用户未登录
	        showTips();
	        $('.l_tips').html('请先登录');
	        setTimeout(function(){
	        	window.location.href = gotologin;
	        },2000)
	        return false;
	    }
	    var infofinish = '{{$infofinish}}';
	    if(infofinish == 1){
	        var gowanshan = "{{url('/authenticate?id=info')}}";
	        $('.popUp').hide();
	        showTips();
	        $('.l_tips').html('请完善资料');
	        window.setTimeout(window.location.reload(),2000);
	        return false;
	    }else{
	  		$('.follow_btn').show();
	        aid              = $(obj).attr('analyst_id');
	        analyst_username = $(obj).attr('analyst_username');
	        status           = $(obj).attr('status');
	        direction        = $(obj).attr('direction');
	        var button_html = $('.l_master_title button').html();
	        if(button_html == "订阅") {
	            var cancleBtn=$(".foot_right>input");
	            cancleBtn.css({"visibility":"hidden"});
	        }
	        if(button_html == "编辑") {
	            var thisBtn=this;
	        }
	        if(status == 1){
	            $('#gendancancle').show();
	            $('.follow_btn').attr('id','follow_btn_cancel');
	        }else{
	            $('#gendancancle').hide();
	        }
	    }
	}
	//去交易大师中心
	function mastercenter(userid,event){
		//取消事件冒泡
		var e=arguments.callee.caller.arguments[0]||event;
		if (e && e.stopPropagation) {
			e.stopPropagation();
		} else if (window.event) {
			window.event.cancelBubble = true;
		}
		var gomastercenter   = "{{url('/mastercenter')}}";
		window.location.href = gomastercenter+'?analyst_id='+userid;
	}

	// 总收益曲线图
	var xmydata11 = [];
	var xmypoint='{{ $totalbbpoint }}';
	var xmytime='{{ $totalbbtime }}';
	xmytime = xmytime.split(',');
	xmypoint = xmypoint.split(',');
	xmypoint.forEach(function(data,index,arr){
	    xmydata11.push(+data);
	});
  profitChart(profit_chart,[xmytime,xmydata11]);
</script>
</html>
</body>
